#pragma once
#include "mainwindowservice.h"
#include <service/event/ctkEventHandler.h>

class ctkPluginContext;
class ctkEventAdmin;
class MainWindow;
class MainWindowImpl : public QObject, public MainWindowService, public ctkEventHandler
{
    Q_OBJECT
    Q_INTERFACES(MainWindowService ctkEventHandler)

public:
    MainWindowImpl(ctkPluginContext *context);
    ~MainWindowImpl();

    void TestInterface() Q_DECL_OVERRIDE;
    /// 发送数据给其他模块
    void postCtkEvent(const QString event, const QVariant data = QVariant(), \
                             const QVariant extentionData = QVariant()) Q_DECL_OVERRIDE;
    /// 退出
    virtual void quitApp() Q_DECL_OVERRIDE;
    /// 带文件启动
    virtual void startAppWithArgs(const QStringList& fileList) Q_DECL_OVERRIDE;
    /// 获取主窗口的View
    virtual QQuickView* getQuickView() Q_DECL_OVERRIDE;

protected:
    void handleEvent(const ctkEvent& event) Q_DECL_OVERRIDE;
    ctkEventAdmin* getEventAdmin();

private:
    ctkPluginContext *m_context;
    MainWindow *m_window;
};
